using System;
using Rarous.NForms.Validation;

namespace Rarous.NForms {
  public class NumericItem : TextItem {
    public NumericItem(Form parent, string name, string label)
      : this(parent, name, label, null) {
    }

    public NumericItem(Form parent, string name, string label, object attributes)
      : base(parent, name, label, attributes) {
      Control.AddClass("numeric");
    }

    public NumericItem AddRule(Predicate<int> predicate, string message) {
      validationRules.Add(new PredicateRule<int>(message, predicate));
      return this;
    }
  }
}
